﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SolutionSorter.Core
{
    public class ContentManager : IContentManager
    {
        public ContentManager(IFileResolver fileResolver, IFileManager fileManager)
        {
            _fileResolver = fileResolver;
            _fileManager = fileManager;
        }

        public string GetContent()
        {
            string filePath = _fileResolver.GetFilePath();
            if (!string.IsNullOrEmpty(filePath))
            {
                return _fileManager.GetContent(filePath);
            }
            else
            {
                return "";
            }
        }

        public void SaveContent(string content)
        {
            _fileManager.SaveContent(_fileResolver.GetFilePath(), content);
        }

        private readonly IFileResolver _fileResolver;
        private readonly IFileManager _fileManager;
    }
}
